package cn.tedu.imop.basic.listener;


import cn.tedu.imop.api.domain.OperationLog;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.time.LocalTime;

@Component
public class OperationLogListener {
    @RabbitListener(queues = "imop.log.queue")
    public void listenOperationLog(String msg) throws InterruptedException, JsonProcessingException {
        System.out.println("log="+msg);
        OperationLog operationLog =
                new ObjectMapper().readValue(msg, OperationLog.class);
        System.out.println("operationLog="+operationLog);
    }
}
